{ "openapi": "3.0.0", "info": { "title": "Pricing Hub (DEPRECATED)", "description": ">⚠️ This API has been deprecated. If you need to associate prices with customers, we recommend using the [Audience API](https:\/\/developers.vtex.com\/docs\/api-reference\/audience-api).\\n\\n. \r\n\r\n In the B2B scenario, it is common for stores to have personalized prices per customer and complex pricing systems that require external integrations. Pricing Hub is a system developed for the B2B context that works as an intermediary between VTEX and external pricing systems.\r\n\r\n In VTEX, B2B stores have the option to use our internal pricing system or an external one. If the store chooses to operate with an external pricing system, Pricing Hub will query an external price calculation API. The external API should then respond with the price for all items in the shopping cart according to its predefined tax rules.\r\n\r\n![Pricing hub protocal diagram](https:\/\/user-images.githubusercontent.com\/77292838\/211634260-e4f7a516-91df-416e-ab43-d9c79d56bc91.png)\r\n\r\n## Implementation\r\n\r\nTo connect with external pricing systems using Pricing Hub, it is necessary to build a VTEX IO middleware app. We offer two reference implementation templates to simplify this process:\r\n\r\n- [C# template](https:\/\/github.com\/vtex-apps\/external-prices-app)\r\n- [Node template](https:\/\/github.com\/vtex-apps\/external-prices-node)\r\n\r\nRead the documentation on each repository to learn more about the required steps to use and customize the app.\r\n\r\n> The app used by Pricing Hub to connect must be a `major 0`. \r\n\r\n### Index\r\n- [POST - Retrieve prices](https:\/\/developers.vtex.com\/docs\/api-reference\/pricing-hub#post-\/api\/pricing-hub\/prices?endpoint=post-\/api\/pricing-hub\/prices)\r\n- [PUT - Configure External Price Source](https:\/\/developers.vtex.com\/docs\/api-reference\/pricing-hub#put-\/api\/pricing-hub\/prices\/config)\r\n\r\n## Common parameters in the documentation\r\n\r\n| Parameter name | Description |\r\n| - | - |\r\n| `{{accountName}}` | Store account name. |\r\n| `{{environment}}` | The environment that will be called. |\r\n| `{{X-VTEX-API-AppKey}}` | Located in the headers of the requests, user authentication key. |\r\n| `{{X-VTEX-API-AppToken}}` | Located in the headers of the requests, authentication password. |", "contact": {}, "version": "1.0" }, "servers": [ { "url": "https://prchub.{environment}.com.br", "description": "VTEX server URL.", "variables": { "environment": { "description": "Environment to use. Used as part of the URL.", "enum": [ "vtexcommercestable" ], "default": "vtexcommercestable" } } } ], "paths": { "/api/pricing-hub/prices": { "post": { "tags": [ "Pricing Hub Prices" ], "summary": "Retrieve prices", "description": ">⚠️ This API has been deprecated. If you need to associate prices with specific customers, we recommend using the [Audience API](https://developers.vtex.com/docs/api-reference/audience-api).\n\nThis route retrieves and applies prices for the items that are passed in the request. Pricing Hub will select the pricing method that will be used for each item and will fetch their respective price from the selected pricing method.", "parameters": [ { "name": "an", "in": "query", "required": true, "description": "Name of the VTEX account. Used as part of the URL.", "schema": { "type": "string", "example": "apiexamples" } }, { "name": "Accept", "in": "header", "required": true, "description": "HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand.", "style": "simple", "schema": { "type": "string", "default": "application/json" } }, { "name": "Content-Type", "in": "header", "description": "Describes the type of the content being sent.", "required": true, "style": "simple", "schema": { "type": "string", "default": "application/json" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPricesRequestObject" }, "example": { "items": [ { "index": 0, "skuId": "13", "quantity": 1, "brandId": "2000000", "sellerId": "1", "priceTableIds": [], "categoriesIds": [ "1" ] } ], "UtmSource": "facebook", "UtmMedium": "social", "UtmCampaign": "summer", "UtmInternalCampaign": "sale", "salesChannel": "1", "email": "customer@email.com" } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/response2" }, "example": { "items": [ { "index": 0, "skuId": "14", "price": 1875, "costPrice": 750, "listPrice": 2500, "priceTable": "1", "priceValidUntil": "2022-03-24T14:57:19Z" }, { "index": 0, "skuId": "14", "price": 200, "costPrice": 200, "listPrice": 200, "priceTable": "1", "priceValidUntil": "2022-03-04T20:00:18Z" } ] } } } } }, "deprecated": false } }, "/api/pricing-hub/prices/config": { "put": { "tags": [ "Pricing Hub Prices" ], "summary": "Configure external price source", "description": ">⚠️ This API has been deprecated. If you need to associate prices with customers, we recommend using the [Audience API](https://developers.vtex.com/docs/api-reference/audience-api).\n\nThis route facilitates setting up an external price source in Pricing Hub. It also allows you to activate or deactivate that source in a given account.", "operationId": "ConfigExternalPriceSource", "parameters": [ { "name": "an", "in": "query", "description": "Name of the VTEX account.", "required": false, "schema": { "type": "string", "example": "apiexamples" } }, { "name": "Accept", "in": "header", "required": true, "description": "HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand.", "style": "simple", "schema": { "type": "string", "default": "application/json" } }, { "name": "Content-Type", "in": "header", "description": "Describes the type of the content being sent.", "required": true, "style": "simple", "schema": { "type": "string", "default": "application/json" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfigExternalPriceSourceRequest" }, "example": { "active": true, "appName": "apiexamples_app_name" } } }, "required": true }, "responses": { "200": { "description": "OK" } } } } }, "components": { "schemas": { "GetPricesRequestObject": { "required": [ "items", "salesChannel", "email" ], "type": "object", "properties": { "items": { "$ref": "#/components/schemas/items" }, "UtmSource": { "type": "string", "example": "facebook", "description": "Traffic source, which indicates where the traffic originated from according to the `utm_source` value in the URL that led to the order. If there is no value, use `null`.", "nullable": true }, "UtmMedium": { "type": "string", "example": "social", "description": "Medium that indicates what type of traffic the customer originated from, represented by the `utm_medium` value in the URL that led to the order. If there is no value, use `null`.", "nullable": true }, "UtmCampaign": { "type": "string", "example": "summer", "description": "Campaign name, represented by the `utm_campaign` value in the URL that led to the order. If there is no value, use `null`." }, "UtmInternalCampaign": { "type": "string", "example": "sale", "description": "Internal campaign name, represented by the `utmi_cp` value in the URL that led to the order. If there is no value, use `null`.", "nullable": true }, "salesChannel": { "type": "string", "example": "1", "description": "Represents Checkout's sales channel." }, "email": { "type": "string", "example": "customer@email.com", "description": "Customer's email address. If there is no value, use an empty string." } } }, "items": { "required": [ "itemsObject" ], "type": "array", "description": "List of items to be priced by Pricing Hub.", "items": { "type": "object", "description": "Each item to be priced by Pricing Hub.", "required": [ "index", "skuId", "quantity", "brandId", "sellerId", "priceTableIds", "categoriesIds" ], "properties": { "index": { "description": "Index of the item at Checkout's cart. It has to be unique in the items array.", "type": "integer", "example": 0 }, "skuId": { "description": "ID of the SKU that will be priced.", "type": "string", "example": "13" }, "quantity": { "description": "This is the amount of items that will be priced. It is possible to have a volume discount for many repeated items. Hence, the price may not be the quantity of the item multiplied by the unitary price.", "type": "integer", "example": 1 }, "brandId": { "description": "Brand ID for the item.", "type": "string", "example": "2000000" }, "sellerId": { "description": "Seller ID for the item.", "type": "string", "example": "1" }, "priceTableIds": { "description": "IDs of the price tables that will be used to compute the price. More than one price table might be passed to the array. The final price rule might be more complex than the lowest or the highest price.", "type": "array", "items": { "type": "string", "example": "1", "description": "ID of a price table that will be used to compute the price." }, "default": [ "1" ] }, "categoriesIds": { "description": "ID of the categories that will be used to compute the price.", "type": "array", "items": { "type": "string", "example": "1", "description": "ID of a category that will be used to compute the price." }, "default": [ "1" ] } } } }, "response2": { "required": [ "items" ], "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/Item1" }, "description": "List of items and their respective prices applied by Pricing Hub." } } }, "Item1": { "required": [ "index", "skuId", "price", "costPrice", "listPrice", "priceTable", "priceValidUntil" ], "type": "object", "description": "Each price item.", "properties": { "index": { "type": "integer", "description": "The same index referring to Checkout's cart that was passed to the API." }, "skuId": { "type": "string", "description": "The same skuId that was passed to the API." }, "price": { "type": "number", "description": "The price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency." }, "costPrice": { "type": "number", "description": "The cost price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency." }, "listPrice": { "type": "number", "description": "The list price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency." }, "priceTable": { "type": "string", "description": "The price table that was used to price the item." }, "priceValidUntil": { "type": "string", "description": "The moment up until the price is valid. After that moment, it will be necessary to call the pricing API again. The format of the string is in RFC3339." } } }, "ConfigExternalPriceSourceRequest": { "required": [ "appName" ], "type": "object", "properties": { "active": { "type": "boolean", "example": false, "description": "Defines if the external price source is active (`true`) or not (`false`). If not set, the default value will be `false`." }, "appName": { "type": "string", "description": "Name of the app that communicates with the external pricing source.", "example": "apiexamples_app_name" } } } }, "securitySchemes": { "appKey": { "type": "apiKey", "in": "header", "name": "X-VTEX-API-AppKey", "description": "Unique identifier of the [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys)." }, "appToken": { "type": "apiKey", "in": "header", "name": "X-VTEX-API-AppToken", "description": "Secret token of the [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys)." }, "VtexIdclientAutCookie": { "type": "apiKey", "in": "header", "name": "VtexIdclientAutCookie", "description": "[User token](https://developers.vtex.com/docs/guides/api-authentication-using-user-tokens), valid for 24 hours." } } }, "tags": [ { "name": "Pricing Hub Prices" } ], "security": [ { "appKey": [], "appToken": [] }, { "VtexIdclientAutCookie": [] } ] }